package net.ibizsys.eclipse.studio.data;

import java.util.HashMap;
import java.util.Map;

/**
 * 运行时类型
 * 
 * @author <a href='http://www.weibo.com/xjtoo' target='_blank'>Enmaai</a>
 */
public enum IBizRuntimeType {
	Unknown("", 0),

	EXTJS5("EXTJS5", 1),

	JQ("JQUERY", 101), JQ_R2("JQUERY_R2", 102),

	NG("ANGULARJS", 201),

	SRV("SRV", 300);

	private String code;
	private int value;

	private IBizRuntimeType(String code, int value) {
		this.code = code;
		this.value = value;
	}

	public String code() {
		return this.code;
	}

	public int value() {
		return this.value;
	}

	private static final Map<String, IBizRuntimeType> map = new HashMap<String, IBizRuntimeType>();
	static {
		for (IBizRuntimeType val : values()) {
			map.put(val.code(), val);
		}
	}

	public static IBizRuntimeType convert(String name) {
		if (map.containsKey(name)) {
			return map.get(name);
		}
		return IBizRuntimeType.Unknown;
	}
}
